<template>
  <div class="appContainer">
    <HeaderLayout />
    <div style="height: 70px"></div>
    <BodyLayout />
    <FooterLayout v-once />
  </div>
</template>

<script name="App" setup>
import HeaderLayout from '@/layout/HeaderLayout.vue';
import BodyLayout from '@/layout/BodyLayout.vue';
import FooterLayout from '@/layout/FooterLayout.vue';
import favoritesStore from '@/stores/favoritesStore';
import { onMounted } from 'vue';
import { decrypt } from '@/utils/encipher';

onMounted(() => {
  // 读取收藏列表
  const faStore = favoritesStore();
  if (localStorage.getItem('favoriteList') !== null) {
    const localFavoriteList = JSON.parse(
      decrypt(localStorage.getItem('favoriteList'))
    ); // 解密
    if (faStore.favoriteList.length < 1 && localFavoriteList !== null) {
      faStore.initFavoriteList(localFavoriteList);
    }
  }
});
</script>

<style lang="scss">
// 页面滚动条
*::-webkit-scrollbar {
  width: 5px;
}

*::-webkit-scrollbar-thumb {
  background-color: $main-color;
}
</style>
